package cn.itrip.biz.controller;

import cn.itrip.beans.dto.Dto;
import cn.itrip.biz.service.ItripAreaDicService;
import cn.itrip.biz.service.ItripFeatureService;
import cn.itrip.biz.service.QueryHotelInfoService;
import cn.itrip.biz.service.QueryMethodService;
import cn.itrip.common.DtoUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.logging.Logger;

@RestController
@RequestMapping("/api/hotel")
public class ItripLableDicController {
    @Resource
    private ItripFeatureService itripFeatureService;
    @Resource
    private ItripAreaDicService itripAreaDicService;
    @Resource
    private QueryMethodService queryMethodService;
    @Resource
    private QueryHotelInfoService queryHotelInfoService;

    @RequestMapping(value = "/queryhotcity/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取酒店特色",httpMethod ="GET")
    public Dto queryHotcity(@PathVariable("id") String id)  {
        try {
            return itripAreaDicService.listQueryHotcity(Long.parseLong(id));
        } catch (Exception e) {
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

    @RequestMapping(value = "/queryhotelfeature",method = RequestMethod.GET)
    @ApiOperation(value = "获取酒店特色",httpMethod ="GET")
    public Dto queryHotelFeature() {
        try {
            return itripFeatureService.listQueryFeature();
        } catch (Exception e) {
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

    @RequestMapping(value = "/querytradearea/{parent}",method = RequestMethod.GET)
    @ApiOperation(value = "根据parentid  获取交易区",httpMethod ="GET")
    public Dto querytradearea(@PathVariable("parent") String parent)  {
        try {
            return queryMethodService.queryListTradearea(parent);
        } catch (Exception e) {
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

    @RequestMapping(value = "/getimg/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取酒店图片",httpMethod ="GET")
    public Dto getImg(@PathVariable("id") String id)  {
        try {
            return queryHotelInfoService.getImg(id);
        } catch (Exception e) {
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

    @RequestMapping(value = "/queryhoteldetails/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "酒店介绍",httpMethod ="GET")
    public Dto queryHotelDetails(@PathVariable("id") String id)  {
        try {
            return queryHotelInfoService.queryHotelDetails(id);
        } catch (Exception e) {
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

    @RequestMapping(value = "/queryhotelfacilities/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "酒店设施",httpMethod ="GET")
    public Dto queryHotelFacilities(@PathVariable("id") String id)  {
        try {
            return queryHotelInfoService.queryHotelFacilities(id);
        } catch (Exception e) {
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

    @RequestMapping(value = "/queryhotelpolicy/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "酒店政策",httpMethod ="GET")
    public Dto queryHotelPolicy(@PathVariable("id") String id)  {
        try {
            return queryHotelInfoService.queryHotelPolicy(id);
        } catch (Exception e) {
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

    @RequestMapping(value = "/getvideodesc/{id}",method =RequestMethod.GET )
    @ApiOperation(value = "视频",httpMethod = "GET")
    public Dto getVideoDesc(@PathVariable("id") String id) {
        return  null;
    }




}
